﻿using Microsoft.AspNetCore.Authorization;
using Simple.Common.Filters;
using Simple.Services;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 预警
/// </summary>
[Route("QHSEEarlyWarning/[action]")]
[ApiController]
public class QHSEEarlyWarningController : ControllerBase
{
    private readonly QHSEEarlyWarningService _earlyWarningService;

    public QHSEEarlyWarningController(QHSEEarlyWarningService earlyWarningService)
    {
        _earlyWarningService = earlyWarningService;
    }
    /// <summary>
    /// 人员预警
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_earlywarning_ryjf")]
    public async Task<AppResult> GetPersonEarlyWarning([FromBody] QHSEEarlyWarningInputModel input)
    {
        var res = await _earlyWarningService.GetPersonEarlyWarningAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 人员预警列表
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_earlywarning_ryjf")]
    public async Task<AppResult> GetPersonEarlyWarningList([FromBody] QHSEEarlyWarningPersonListInputModel input)
    {
        var res = await _earlyWarningService.GetEarlyWarningPersonListAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 单位隐患预警
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_earlywarning_dwyh")]
    public async Task<AppResult> GetDepartmentDangerEarlyWarning([FromBody] QHSEEarlyWarningInputModel input)
    {
        var res = await _earlyWarningService.GetDepartmentDangerEarlyWarningAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 单位隐患预警列表
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_earlywarning_dwyh")]
    public async Task<AppResult> GetDepartmentDangerEarlyWarningList([FromBody] QHSEEarlyWarningInputModel input)
    {
        var res = await _earlyWarningService.GetDepartmentDangerEarlyWarningListAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 单位违章预警列表
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_earlywarning_dwyh")]
    public async Task<AppResult> GetDepartmentViolationEarlyWarningList([FromBody] QHSEEarlyWarningInputModel input)
    {
        var res = await _earlyWarningService.GetDepartmentViolationEarlyWarningListAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 单位违章预警
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_unitViolationWarning")]
    public async Task<AppResult> GetDepartmentViolationEarlyWarning([FromBody] QHSEEarlyWarningInputModel input)
    {
        var res = await _earlyWarningService.GetDepartmentViolationEarlyWarningAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 通知框
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> GetDangerEarlyWarningNotice([FromBody] IdInputModel input)
    {
        var res = await _earlyWarningService.GetEarlyWarningNoticeAsync(input);
        return AppResult.Status200OK(data: res);
    }
}

